package org.demo.spring.data.transaction;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.sql.SQLException;

/**
 * 目标：通过Spring 的DataSourceTransactionManagement实现对自定义JDBC的事务管理
 * 实现：把JDBC的dataSource交给DataSourceTransactionManager来管理及可
 * DataSourceTransactionManager会在获取连接的时候进行AOP来完成事务的管理
 * <tx:annotation-driven  transaction-manager="transactionManager"/>配置的时候需要注意下不要导错命名空间
 * 此注解启用@Transactional
 *
 *
 *
 *
 *
 */
public class Test {
    public static void main(String[] args) throws SQLException {
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext-jdbc-transaction-test.xml");
        UserService userService = (UserService) applicationContext.getBean("userService");
        userService.say();

    }
}
